Repository navigation
HBASE-18886 Backup repair does not release an exclusive lock taken by an operation that never recorded itself - #8921
Open
SpookyJumpyBeans wants to merge 1 commit into
Open
SpookyJumpyBeans wants to merge 1 commit into
SpookyJumpyBeans wants to merge 1 commit into
Conversation
… an operation that never recorded itself
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/HBASE-18886
A backup takes the backup exclusive lock (
activesession:in the backup system table) inTableBackupClient.init, and writes its RUNNING record later inbeginBackup. If it fails in between, the lock staysyeswith no record, andhbase backup repairreturns 0 without releasing it, so every later backup create, delete and merge fails to take the lock.Two ways to get there:
checkAndMutateis not idempotent under client retries (HBASE-15588), so the retried conditional put findsyesand fails, and the backup waits for its own lock untilhbase.backup.exclusive.op.timeout.secondsand fails.BackupAdminImpl.deleteBackupsreturns -1 holding the lock on the same lost response.Changes
BackupSystemTable.isBackupExclusiveOperationActive(): reads whether the lock is held.RepairCommand: when there is no RUNNING backup, after repairing failed deletes and merges, release the lock if it is still held, and say so:Repair already assumes no backup operation is running: when it finds a RUNNING backup it marks it failed and releases the lock without checking whether it is alive, and it deletes the backup system table snapshot unconditionally. This change covers the case where the operation never recorded itself, under the same assumption. If a delete or merge repair runs first, it leaves the lock released, so the new check does nothing.
Not changed
checkAndMutateretry idempotency (HBASE-15588).finishBackupExclusiveOperationwhen the lock is already released (HBASE-28103).Tests
TestRepairAfterLostBackupLockResponsemakes the backup system table region fail the first successful update of the lock after applying it, which simulates a lost response. It checks that the backup fails without recording a session, that the lock is held, thatrepairreturns 0 and releases it, and that the next backup succeeds. Without this change it fails at "Backup should succeed after repair" (the backup times out waiting for the lock).I ran it with
TestBackupRepair,TestRepairAfterFailedDelete,TestBackupDeleteWithFailures,TestIncrementalBackupMergeWithFailuresandTestBackupSystemTableon Linux (WSL) with JDK 21; all pass.